package com.sense.kukoo.biz_messages.model

import com.sense.kukoo.common.mvvm.model.BaseMvvmModel
import com.sense.kukoo.common.repo.bean.ResultBean
import com.sense.kukoo.common.repo.http.KukooHttpApi
import com.sense.kukoo.common.repo.http.KukooHttpManager
import com.sense.kukoo.common.repo.http.bean.UserMessageLikeBean
import okhttp3.RequestBody

class MessagesLikesModel: BaseMvvmModel() {

    private val TAG: String = javaClass.simpleName

    override fun onModelCleared() {}

    suspend fun messageLikes(pageIndex: Int, pageSize: Int): ResultBean<ArrayList<UserMessageLikeBean>> {
        val hashMap = HashMap<String, Any>()
        if(false){
            hashMap.put("currentUserId", "")
            hashMap.put("limit1", "")
            hashMap.put("limit2", "")
        }
        hashMap.put("pageIndex", pageIndex)
        hashMap.put("pageSize", pageSize)
        hashMap.put("type", 1)
        val mRequestBody: RequestBody = KukooHttpManager.createRequestBody(hashMap)

        return KukooHttpManager.instance
            .createHttpClient(KukooHttpApi::class.java)
            .messageLikes(mRequestBody)
    }

    suspend fun messageDelete(id: Long): ResultBean<Boolean> {
        val hashMap = HashMap<String, Any>()
        hashMap.put("id", id)
        hashMap.put("type", 1)
        val mRequestBody: RequestBody = KukooHttpManager.createRequestBody(hashMap)

        return KukooHttpManager.instance
            .createHttpClient(KukooHttpApi::class.java)
            .messageDelete(mRequestBody)
    }
}